﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Platform.Storage.Redis.Hash
{

	/// <summary>
	/// 
	/// </summary>
	public interface IHashObject
	{
		/// <summary>
		/// 
		/// </summary>
		/// <param name="fieldName"></param>
		/// <param name="fieldValue"></param>
		//void SetValue( string fieldName, string fieldValue );

		/// <summary>
		/// 
		/// </summary>
		/// <param name="values"></param>
		//void SetValue( IDictionary<string, string> values );

		/// <summary>
		/// 
		/// </summary>
		/// <param name="fieldName"></param>
		/// <returns></returns>
		//string GetValue( string fieldName );

		/// <summary>
		/// 
		/// </summary>
		/// <param name="fields"></param>
		/// <returns></returns>
		//IEnumerable<string> GetValue( params string[] fields );

		/// <summary>
		/// 
		/// </summary>
		/// <param name="fieldName"></param>
		/// <param name="step"></param>
		/// <returns></returns>
		[RedisCommand( "HINCRBY" )]
		int Increment( string fieldName, int step );

		/// <summary>
		/// Envia as alterações alteradas de uma única vez
		/// </summary>
		int Commit();

		/// <summary>
		/// Carrega todos as chaves do objeto 
		/// </summary>
		void ReadValues();
	}


	[AttributeUsage( AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method )]
	public sealed class RedisCommandAttribute : Attribute
	{

		public RedisCommandAttribute( string command )
		{
			this.Command = command;
		}

		/// <summary>
		/// 
		/// </summary>
		public string Command
		{ get; private set; }
	}
}
